using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Spinning.Spinning.Unitity;
using Microsoft.Xna.Framework;

namespace Spinning.Spinning.Entity
{
    class TextEntity : BaseEntity
    {
        public string fontString = "";
        SpriteFont _font;
        public string Value { get; set; }
    
        public override void OnLoad()
        {
            if (fontString.Length == 0)
                throw new Exception("fontString");
            _font = ResourceManager.LoadSpriteFont(fontString);
            Value = "None";
            Static = true;
        }

        protected override void DrawSelf(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.DrawSelf(spriteBatch, gameTime);
           
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Projection);
            spriteBatch.DrawString(_font, Value, Position, Color, Rotation, Origin * _font.MeasureString(Value), Scale, SpriteEffects.None, 0);
            spriteBatch.End();
        }

    }
}
